home *** CD-ROM | disk | FTP | other *** search
/ Chip 2006 July / CHIP 2006-07.2.iso / program / web_gelistirme / easyphp1-7_setup.exe / {app} / phpmyadmin / tbl_properties.inc.php < prev    next >
Encoding:
PHP Script  |  2003-09-07  |  26.4 KB  |  677 lines

  1. <?php
  2. /* $Id: tbl_properties.inc.php,v 1.62 2003/07/19 12:12:18 lem9 Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5. // Check parameters
  6.  
  7. if (!defined('PMA_COMMON_LIB_INCLUDED')) {
  8.     include('./libraries/common.lib.php');
  9. }
  10.  
  11. PMA_checkParameters(array('db','table','action','num_fields'));
  12.  
  13.  
  14. // Get available character sets (MySQL >= 4.1)
  15. if (PMA_MYSQL_INT_VERSION >= 40100 && !defined('PMA_MYSQL_CHARSETS_LIB_INCLUDED')) {
  16.     include('./libraries/mysql_charsets.lib.php');
  17. }
  18.  
  19. ?>
  20. <?php if ($cfg['CtrlArrowsMoving']) { ?>
  21. <!-- Set on key handler for moving using by Ctrl+arrows -->
  22. <script type="text/javascript" language="javascript">
  23. <!--
  24. document.onkeydown = onKeyDownArrowsHandler;
  25. // -->
  26. </script>
  27. <?php } ?>
  28.  
  29. <form method="post" action="<?php echo $action; ?>" onsubmit="return checkTableEditForm(this, <?php echo $num_fields; ?>)" >
  30. <?php
  31. echo PMA_generate_common_hidden_inputs($db, $table);
  32. if ($action == 'tbl_create.php') {
  33.     ?>
  34.     <input type="hidden" name="reload" value="1" />
  35.     <?php
  36. }
  37. else if ($action == 'tbl_addfield.php') {
  38.     echo "\n";
  39.     ?>
  40.     <input type="hidden" name="after_field" value="<?php echo $after_field; ?>" />
  41.     <?php
  42. }
  43. echo "\n";
  44.  
  45. if (isset($num_fields)) {
  46.     ?>
  47.     <input type="hidden" name="orig_num_fields" value="<?php echo $num_fields; ?>" />
  48.     <?php
  49. }
  50.  
  51. if (isset($after_field)) {
  52.     ?>
  53.     <input type="hidden" name="orig_after_field" value="<?php echo $after_field; ?>" />
  54.     <?php
  55. }
  56.  
  57. if (isset($selected) && is_array($selected)) {
  58.     @reset($selected);
  59.     while(list($o_fld_nr, $o_fld_val) = each($selected)) {
  60.     ?>
  61.     <input type="hidden" name="selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
  62.     <?php
  63.         if (!isset($true_selected)) {
  64.             ?>
  65.     <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
  66.             <?php
  67.         }
  68.  
  69.     }
  70.  
  71.     if (isset($true_selected) && is_array($true_selected)) {
  72.         @reset($true_selected);
  73.         while(list($o_fld_nr, $o_fld_val) = each($true_selected)) {
  74.         ?>
  75.         <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
  76.         <?php
  77.         }
  78.     }
  79.  
  80. } elseif (isset($field)) {
  81.     ?>
  82.     <input type="hidden" name="orig_field" value="<?php echo urlencode($field); ?>" />
  83.     <input type="hidden" name="true_selected[] value="<?php echo (isset($orig_field) ? $orig_field : urlencode($field)); ?>" />
  84.     <?php
  85. }
  86.  
  87. $is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php');
  88.  
  89. $header_cells = array();
  90. $content_cells = array();
  91.  
  92. $header_cells[] = $strField;
  93. $header_cells[] = $strType . '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('Reference', 'Column_types') . '</span>';
  94. $header_cells[] = $strLengthSet;
  95. if (PMA_MYSQL_INT_VERSION >= 40100) {
  96.     $header_cells[] = $strCharset;
  97. }
  98. $header_cells[] = $strAttr;
  99. $header_cells[] = $strNull;
  100. $header_cells[] = $strDefault . '**';
  101. $header_cells[] = $strExtra;
  102.  
  103. require('./libraries/relation.lib.php');
  104. require('./libraries/transformations.lib.php');
  105. $cfgRelation = PMA_getRelationsParam();
  106.  
  107. $comments_map = array();
  108. $mime_map = array();
  109. $available_mime = array();
  110.  
  111. if ($cfgRelation['commwork']) {
  112.     $comments_map = PMA_getComments($db, $table);
  113.     $header_cells[] = $strComments;
  114.  
  115.     if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
  116.         $mime_map = PMA_getMIME($db, $table);
  117.         $available_mime = PMA_getAvailableMIMEtypes();
  118.  
  119.         $header_cells[] = $strMIME_MIMEtype;
  120.         $header_cells[] = $strMIME_transformation;
  121.         $header_cells[] = $strMIME_transformation_options . '***';
  122.     }
  123. }
  124.  
  125.  
  126. // lem9: We could remove this 'if' and let the key information be shown and
  127. // editable. However, for this to work, tbl_alter must be modified to use the
  128. // key fields, as tbl_addfield does.
  129.  
  130. if (!$is_backup) {
  131.     $header_cells[] = $strPrimary;
  132.     $header_cells[] = $strIndex;
  133.     $header_cells[] = $strUnique;
  134.     $header_cells[] = '---';
  135.     $header_cells[] = $strIdxFulltext;
  136. }
  137.  
  138. // garvin: workaround for field_fulltext, because its submitted indizes contain
  139. //         the index as a value, not a key. Inserted here for easier maintaineance
  140. //         and less code to change in existing files.
  141. if (isset($field_fulltext) && is_array($field_fulltext)) {
  142.     @reset($field_fulltext);
  143.     while(list($fulltext_nr, $fulltext_indexkey) = each($field_fulltext)) {
  144.         $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
  145.     }
  146. }
  147.  
  148. for ($i = 0 ; $i < $num_fields; $i++) {
  149.     $submit_null = FALSE;
  150.     if (isset($regenerate) && $regenerate == TRUE) {
  151.         // An error happened with previous inputs, so we will restore the data
  152.         // to embed it once again in this form.
  153.  
  154.         $row['Field']     = (isset($field_name) && isset($field_name[$i]) ? $field_name[$i] : FALSE);
  155.         $row['Type']      = (isset($field_type) && isset($field_type[$i]) ? $field_type[$i] : FALSE);
  156.         $row['Null']      = (isset($field_null) && isset($field_null[$i]) ? $field_null[$i] : '');
  157.         if ($row['Null'] == '') {
  158.             $submit_null = TRUE;
  159.         }
  160.  
  161.         if (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'primary_' . $i) {
  162.             $row['Key'] = 'PRI';
  163.         } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'index_' . $i) {
  164.             $row['Key'] = 'MUL';
  165.         } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'unique_' . $i) {
  166.             $row['Key'] = 'UNI';
  167.         } else {
  168.             $row['Key'] = '';
  169.         }
  170.  
  171.         $row['Default']   = (isset($field_default) && isset($field_default[$i]) ? $field_default[$i] : FALSE);
  172.         $row['Extra']     = (isset($field_extra) && isset($field_extra[$i]) ? $field_extra[$i] : FALSE);
  173.         $row['Comment']   = (isset($submit_fulltext) && isset($submit_fulltext[$i]) && ($submit_fulltext[$i] == $i) ? 'FULLTEXT' : FALSE);
  174.  
  175.         $submit_length    = (isset($field_length) && isset($field_length[$i]) ? $field_length[$i] : FALSE);
  176.         $submit_attribute = (isset($field_attribute) && isset($field_attribute[$i]) ? $field_attribute[$i] : FALSE);
  177.  
  178.         if (isset($field_comments) && isset($field_comments[$i])) {
  179.             $comments_map[$row['Field']] = $field_comments[$i];
  180.         }
  181.  
  182.         if (isset($field_mimetype) && isset($field_mimetype[$i])) {
  183.             $mime_map[$row['Field']]['mimetype'] = $field_mimetype[$i];
  184.         }
  185.  
  186.         if (isset($field_transformation) && isset($field_transformation[$i])) {
  187.             $mime_map[$row['Field']]['transformation'] = $field_transformation[$i];
  188.         }
  189.  
  190.         if (isset($field_transformation_options) && isset($field_transformation_options[$i])) {
  191.             $mime_map[$row['Field']]['transformation_options'] = $field_transformation_options[$i];
  192.         }
  193.  
  194.     } elseif (isset($fields_meta)) {
  195.         $row = $fields_meta[$i];
  196.     }
  197.  
  198.     $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
  199.  
  200.     // Cell index: If certain fields get left out, the counter shouldn't chage.
  201.     $ci = 0;
  202.     // Everytime a cell shall be left out the STRG-jumping feature, $ci_offset
  203.     // has to be incremented ($ci_offset++)
  204.     $ci_offset = -1;
  205.  
  206.     if ($is_backup) {
  207.         $backup_field = (isset($true_selected) && $true_selected[$i] ? $true_selected[$i] : (isset($row) && isset($row['Field']) ? urlencode($row['Field']) : ''));
  208.         $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_orig[]" value="' . $backup_field . '" />' . "\n";
  209.     } else {
  210.         $content_cells[$i][$ci] = '';
  211.     }
  212.  
  213.     $content_cells[$i][$ci] .= "\n" . '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_name[]" size="10" maxlength="64" value="' . (isset($row) && isset($row['Field']) ? str_replace('"', '"', $row['Field']) : '') . '" class="textfield" />';
  214.     $ci++;
  215.     $content_cells[$i][$ci] = '<select name="field_type[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
  216.  
  217.     if (empty($row['Type'])) {
  218.         $row['Type'] = '';
  219.         $type        = '';
  220.     }
  221.     else {
  222.         $type        = $row['Type'];
  223.     }
  224.     // set or enum types: slashes single quotes inside options
  225.     if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) {
  226.         $type   = $tmp[1];
  227.         $length = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1);
  228.     } else {
  229.         $type   = eregi_replace('BINARY', '', $type);
  230.         $type   = eregi_replace('ZEROFILL', '', $type);
  231.         $type   = eregi_replace('UNSIGNED', '', $type);
  232.  
  233.         if (strpos($type, '(')) {
  234.             $length = chop(substr($type, (strpos($type, '(') + 1), (strpos($type, ')') - strpos($type, '(') - 1)));
  235.             $type = chop(substr($type, 0, strpos($type, '(')));
  236.         } else {
  237.             $length = '';
  238.         }
  239.     } // end if else
  240.  
  241.     // some types, for example longtext, are reported as
  242.     // "longtext character set latin7" when not latin1
  243.     if (PMA_MYSQL_INT_VERSION >= 40100) {
  244.         $tmp = strpos($type, 'character set');
  245.         if ($tmp) {
  246.             $type = substr($type,0,$tmp-1);
  247.         }
  248.     }
  249.  
  250.     if (isset($submit_length) && $submit_length != FALSE) {
  251.         $length = $submit_length;
  252.     }
  253.  
  254.     for ($j = 0; $j < count($cfg['ColumnTypes']); $j++) {
  255.         $content_cells[$i][$ci] .= '                <option value="'. $cfg['ColumnTypes'][$j] . '"';
  256.         if (strtoupper($type) == strtoupper($cfg['ColumnTypes'][$j])) {
  257.             $content_cells[$i][$ci] .= ' selected="selected"';
  258.         }
  259.         $content_cells[$i][$ci] .= '>' . $cfg['ColumnTypes'][$j] . '</option>' . "\n";
  260.     } // end for
  261.  
  262.     $content_cells[$i][$ci] .= '    </select>';
  263.     $ci++;
  264.  
  265.     if ($is_backup) {
  266.         $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_length_orig[]" value="' . urlencode($length) . '" />';
  267.     } else {
  268.         $content_cells[$i][$ci] = '';
  269.     }
  270.  
  271.     $content_cells[$i][$ci] .= "\n" . '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_length[]" size="8" value="' . str_replace('"', '"', $length) . '" class="textfield" />' . "\n";
  272.     $ci++;
  273.  
  274.     if (eregi('^(set|enum)$', $type)) {
  275.         $binary           = 0;
  276.         $unsigned         = 0;
  277.         $zerofill         = 0;
  278.     } else {
  279.         $binary           = eregi('BINARY', $row['Type'], $test_attribute1);
  280.         $unsigned         = eregi('UNSIGNED', $row['Type'], $test_attribute2);
  281.         $zerofill         = eregi('ZEROFILL', $row['Type'], $test_attribute3);
  282.     }
  283.  
  284.     if (PMA_MYSQL_INT_VERSION >= 40100) {
  285.         $content_cells[$i][$ci] = '<select name="field_charset[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n"
  286.                                 . '    <option value=""></option>' . "\n";
  287.         if (!empty($row['Collation']) && (
  288.             strtolower(substr($type, 0, 4)) == 'char'
  289.             || strtolower(substr($type, 0, 7)) == 'varchar'
  290.             || strtolower(substr($type, 0, 4)) == 'text'
  291.             || strtolower(substr($type, 0, 8)) == 'tinytext'
  292.             || strtolower(substr($type, 0, 10)) == 'mediumtext'
  293.             || strtolower(substr($type, 0, 8)) == 'longtext'
  294.             || strtolower(substr($type, 0, 3)) == 'set'
  295.             || strtolower(substr($type, 0, 4)) == 'enum'
  296.             ) && !$binary) {
  297.             $real_charset = strpos($row['Collation'], '_') ? substr($row['Collation'], 0, strpos($row['Collation'], '_')) : $row['Collation'];
  298.         } else {
  299.             $real_charset = '';
  300.         }
  301.         for ($j = 0; isset($mysql_charsets[$j]); $j++) {
  302.             $content_cells[$i][$ci] .= '    <option value="' . $mysql_charsets[$j] . '"' . ($mysql_charsets[$j] == $real_charset ? ' selected="selected"' : '') . '>' . $mysql_charsets[$j] . '</option>' . "\n";
  303.         }
  304.         unset($j);
  305.         unset($real_charset);
  306.         $content_cells[$i][$ci] .= '</select>' . "\n";
  307.         $ci++;
  308.     }
  309.  
  310.     $content_cells[$i][$ci] = '<select name="field_attribute[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
  311.  
  312.     $strAttribute     = '';
  313.     if ($binary) {
  314.         $strAttribute = 'BINARY';
  315.     }
  316.     if ($unsigned) {
  317.         $strAttribute = 'UNSIGNED';
  318.     }
  319.     if ($zerofill) {
  320.         $strAttribute = 'UNSIGNED ZEROFILL';
  321.     }
  322.  
  323.     if (isset($submit_attribute) && $submit_attribute != FALSE) {
  324.         $strAttribute = $submit_attribute;
  325.     }
  326.  
  327.     for ($j = 0;$j < count($cfg['AttributeTypes']); $j++) {
  328.         $content_cells[$i][$ci] .= '                <option value="'. $cfg['AttributeTypes'][$j] . '"';
  329.         if (strtoupper($strAttribute) == strtoupper($cfg['AttributeTypes'][$j])) {
  330.             $content_cells[$i][$ci] .= ' selected="selected"';
  331.         }
  332.         $content_cells[$i][$ci] .= '>' . $cfg['AttributeTypes'][$j] . '</option>' . "\n";
  333.     }
  334.  
  335.     $content_cells[$i][$ci] .= '</select>';
  336.     $ci++;
  337.  
  338.     $content_cells[$i][$ci] = '<select name="field_null[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
  339.  
  340.     if ((!isset($row) || empty($row['Null']) || $row['Null'] == 'NOT NULL') && $submit_null == FALSE) {
  341.         $content_cells[$i][$ci] .= "\n";
  342.         $content_cells[$i][$ci] .= '    <option value="NOT NULL">not null</option>' . "\n";
  343.         $content_cells[$i][$ci] .= '    <option value="">null</option>' . "\n";
  344.     } else {
  345.         $content_cells[$i][$ci] .= "\n";
  346.         $content_cells[$i][$ci] .= '    <option value="">null</option>' . "\n";
  347.         $content_cells[$i][$ci] .= '    <option value="NOT NULL">not null</option>' . "\n";
  348.     }
  349.  
  350.     $content_cells[$i][$ci] .= "\n" . '</select>';
  351.     $ci++;
  352.  
  353.     if (isset($row)
  354.         && !isset($row['Default']) && !empty($row['Null'])) {
  355.         $row['Default'] = 'NULL';
  356.     }
  357.  
  358.     if ($is_backup) {
  359.         $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_default_orig[]" size="8" value="' . (isset($row) && isset($row['Default']) ? urlencode($row['Default']) : '') . '" />';
  360.     } else {
  361.         $content_cells[$i][$ci] = "\n";
  362.     }
  363.  
  364.     $content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_default[]" size="8" value="' . (isset($row) && isset($row['Default']) ? str_replace('"', '"', $row['Default']) : '') . '" class="textfield" />';
  365.     $ci++;
  366.  
  367.     $content_cells[$i][$ci] = '<select name="field_extra[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
  368.  
  369.     if(!isset($row) || empty($row['Extra'])) {
  370.         $content_cells[$i][$ci] .= "\n";
  371.         $content_cells[$i][$ci] .= '<option value=""></option>' . "\n";
  372.         $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n";
  373.     } else {
  374.         $content_cells[$i][$ci] .= "\n";
  375.         $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n";
  376.         $content_cells[$i][$ci] .= '<option value=""></option>' . "\n";
  377.     }
  378.  
  379.     $content_cells[$i][$ci] .= "\n" . '</select>';
  380.     $ci++;
  381.  
  382.     // garvin: comments
  383.     if ($cfgRelation['commwork']) {
  384.         $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_comments[]" size="8" value="' . (isset($row) && isset($row['Field']) && is_array($comments_map) && isset($comments_map[$row['Field']]) ?  htmlspecialchars($comments_map[$row['Field']]) : '') . '" class="textfield" />';
  385.         $ci++;
  386.     }
  387.  
  388.     // garvin: MIME-types
  389.     if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) {
  390.         $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[]">' . "\n";
  391.         $content_cells[$i][$ci] .= '    <option value=""></option>' . "\n";
  392.         $content_cells[$i][$ci] .= '    <option value="auto">auto-detect</option>' . "\n";
  393.  
  394.         if (is_array($available_mime['mimetype'])) {
  395.             @reset($available_mime['mimetype']);
  396.             while(list($mimekey, $mimetype) = each($available_mime['mimetype'])) {
  397.                 $checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['mimetype']) && ($mime_map[$row['Field']]['mimetype'] == str_replace('/', '_', $mimetype)) ? 'selected ' : '');
  398.                 $content_cells[$i][$ci] .= '    <option value="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option>';
  399.             }
  400.         }
  401.  
  402.         $content_cells[$i][$ci] .= '</select>';
  403.         $ci++;
  404.  
  405.         $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_transformation[]">' . "\n";
  406.         $content_cells[$i][$ci] .= '    <option value="" title="' . $strNone . '"></option>' . "\n";
  407.         if (is_array($available_mime['transformation'])) {
  408.             @reset($available_mime['transformation']);
  409.             while(list($mimekey, $transform) = each($available_mime['transformation'])) {
  410.                 $checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation']) && ($mime_map[$row['Field']]['transformation'] == $available_mime['transformation_file'][$mimekey]) ? 'selected ' : '');
  411.                 $tooltip = 'strTransformation_' . strtolower(str_replace('.inc.php', '', $available_mime['transformation_file'][$mimekey]));
  412.                 $tooltip = isset($$tooltip) ? $$tooltip : sprintf(str_replace('<br />', ' ', $strMIME_nodescription), 'PMA_transformation_' . $tooltip . '()');
  413.                 $content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . $tooltip . '">' . htmlspecialchars($transform) . '</option>' . "\n";
  414.             }
  415.         }
  416.  
  417.         $content_cells[$i][$ci] .= '</select>';
  418.         $ci++;
  419.  
  420.         $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_transformation_options[]" size="8" value="' . (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation_options']) ?  htmlspecialchars($mime_map[$row['Field']]['transformation_options']) : '') . '" class="textfield" />';
  421.         $ci++;
  422.     }
  423.  
  424.     // lem9: See my other comment about removing this 'if'.
  425.     if (!$is_backup) {
  426.         if (isset($row) && isset($row['Key']) && $row['Key'] == 'PRI') {
  427.             $checked_primary = ' checked="checked"';
  428.         } else {
  429.             $checked_primary = '';
  430.         }
  431.         if (isset($row) && isset($row['Key']) && $row['Key'] == 'MUL') {
  432.             $checked_index   = ' checked="checked"';
  433.         } else {
  434.             $checked_index   = '';
  435.         }
  436.         if (isset($row) && isset($row['Key']) && $row['Key'] == 'UNI') {
  437.             $checked_unique   = ' checked="checked"';
  438.         } else {
  439.             $checked_unique   = '';
  440.         }
  441.         if (empty($checked_primary)
  442.             && empty($checked_index)
  443.             && empty($checked_unique)) {
  444.             $checked_none = ' checked="checked"';
  445.         } else {
  446.             $checked_none = '';
  447.         }
  448.  
  449.         if (PMA_MYSQL_INT_VERSION >= 32323
  450.             &&(isset($row) && isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) {
  451.             $checked_fulltext = ' checked="checked"';
  452.         } else {
  453.             $checked_fulltext = '';
  454.         }
  455.  
  456.         $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="primary_' . $i . '"' . $checked_primary . ' />';
  457.         $ci++;
  458.  
  459.         $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="index_' . $i . '"' .  $checked_index . ' />';
  460.         $ci++;
  461.  
  462.         $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="unique_' . $i . '"' .  $checked_unique . ' />';
  463.         $ci++;
  464.  
  465.         $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="none_' . $i . '"' .  $checked_none . ' />';
  466.         $ci++;
  467.  
  468.         if (PMA_MYSQL_INT_VERSION >= 32323) {
  469.             $content_cells[$i][$ci] = '<input type="checkbox" name="field_fulltext[]" value="' . $i . '"' . $checked_fulltext . ' />';
  470.         } // end if (PMA_MYSQL_INT_VERSION >= 32323)
  471.     } // end if ($action ==...)
  472. } // end for
  473.  
  474. if ($cfg['DefaultPropDisplay'] == 'horizontal') {
  475. ?>
  476.     <table border="<?php echo $cfg['Border']; ?>">
  477.     <tr>
  478. <?php
  479. @reset($header_cells);
  480. while(@list($header_nr, $header_val) = @each($header_cells)) {
  481. ?>
  482.         <th><?php echo $header_val; ?></th>
  483. <?php
  484. }
  485. ?>
  486.     </tr>
  487. <?php
  488. @reset($content_cells);
  489. $i = 0;
  490. while(@list($content_nr, $content_row) = @each($content_cells)) {
  491.     $i++;
  492.     echo "\n" . '<tr>' . "\n";
  493.  
  494.     $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
  495.  
  496.     while(list($content_row_nr, $content_row_val) = @each($content_row)) {
  497. ?>
  498.         <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_row_val; ?></td>
  499. <?php
  500.     }
  501.     echo "\n" . '</tr>' . "\n";
  502. }
  503. ?>
  504.     </table>
  505.     <br />
  506. <?php
  507. } else {
  508. ?>
  509.     <table border="<?php echo $cfg['Border']; ?>">
  510. <?php
  511. @reset($header_cells);
  512. $i = 0;
  513. while(@list($header_nr, $header_val) = @each($header_cells)) {
  514.     echo "\n" . '<tr>' . "\n";
  515. ?>
  516.         <th align="right"><?php echo $header_val; ?></th>
  517. <?php
  518.     for ($j = 0; $j < count($content_cells); $j++) {
  519.         if (isset($content_cells[$j][$i]) && $content_cells[$j][$i] != '') {
  520.             $bgcolor = ($j % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
  521.     ?>
  522.         <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_cells[$j][$i]; ?></td>
  523.     <?php
  524.         }
  525.     }
  526.  
  527.     echo "\n" . '</tr>' . "\n";
  528.     $i++;
  529. }
  530. ?>
  531.     </table>
  532.     <br />
  533. <?php
  534. }
  535.  
  536. if ($action == 'tbl_create.php' && PMA_MYSQL_INT_VERSION >= 32300) {
  537.     echo "\n";
  538.     ?>
  539.     <table>
  540.     <tr valign="top">
  541.         <td><?php echo $strTableComments; ?> :</td>
  542.     <?php
  543.     if ($action == 'tbl_create.php') {
  544.         echo "\n";
  545.         ?>
  546.         <td width="25"> </td>
  547.         <td><?php echo $strTableType; ?> :</td>
  548.         <?php
  549.         if (PMA_MYSQL_INT_VERSION >= 40100) {
  550.             echo '        <td width="25"> </td>' . "\n"
  551.                . '        <td>' . $strCharset . ' :</td>' . "\n";
  552.         }
  553.     }
  554.     echo "\n";
  555.     ?>
  556.     </tr>
  557.     <tr>
  558.         <td>
  559.             <input type="text" name="comment" size="40" maxlength="80" value="<?php echo (isset($comment) ? $comment : ''); ?>" class="textfield" />
  560.         </td>
  561.     <?php
  562.     // BEGIN - Table Type - 2 May 2001 - Robbat2
  563.     // change by staybyte - 11 June 2001
  564.     if ($action == 'tbl_create.php') {
  565.         // find mysql capability - staybyte - 11. June 2001
  566.         $query = 'SHOW VARIABLES LIKE \'have_%\'';
  567.         $result = PMA_mysql_query($query);
  568.         if ($result != FALSE && mysql_num_rows($result) > 0) {
  569.             while ($tmp = PMA_mysql_fetch_array($result)) {
  570.                 if (isset($tmp['Variable_name'])) {
  571.                     switch ($tmp['Variable_name']) {
  572.                         case 'have_bdb':
  573.                             if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
  574.                                 $tbl_bdb    = TRUE;
  575.                             }
  576.                             break;
  577.                         case 'have_gemini':
  578.                             if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
  579.                                 $tbl_gemini = TRUE;
  580.                             }
  581.                             break;
  582.                         case 'have_innodb':
  583.                             if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
  584.                                 $tbl_innodb = TRUE;
  585.                             }
  586.                             break;
  587.                         case 'have_isam':
  588.                             if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
  589.                                 $tbl_isam   = TRUE;
  590.                             }
  591.                             break;
  592.                     } // end switch
  593.                 } // end if
  594.             } // end while
  595.         } // end if
  596.         mysql_free_result($result);
  597.  
  598.         echo "\n";
  599.         ?>
  600.         <td width="25"> </td>
  601.         <td>
  602.             <select name="tbl_type">
  603.                 <option <?php echo (isset($tbl_type) && $tbl_type == 'Default' ? 'selected="checked"' : ''); ?> value="Default"><?php echo $strDefault; ?></option>
  604.                 <option <?php echo (isset($tbl_type) && $tbl_type == 'MYISAM' ? 'selected="checked"' : ''); ?> value="MYISAM">MyISAM</option>
  605.                 <option <?php echo (isset($tbl_type) && $tbl_type == 'HEAP' ? 'selected="checked"' : ''); ?> value="HEAP">Heap</option>
  606.                 <option <?php echo (isset($tbl_type) && $tbl_type == 'MERGE' ? 'selected="checked"' : ''); ?> value="MERGE">Merge</option>
  607.                 <?php if (isset($tbl_bdb)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'BDB' ? 'selected="checked"' : ''); ?> value="BDB">Berkeley DB</option><?php } ?>
  608.                 <?php if (isset($tbl_gemini)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'GEMINI' ? 'selected="checked"' : ''); ?> value="GEMINI">Gemini</option><?php } ?>
  609.                 <?php if (isset($tbl_innodb)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'INNO DB' ? 'selected="checked"' : ''); ?> value="InnoDB">INNO DB</option><?php } ?>
  610.                 <?php if (isset($tbl_isam)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'ISAM' ? 'selected="checked"' : ''); ?> value="ISAM">ISAM</option><?php } ?>
  611.             </select>
  612.         </td>
  613.         <?php
  614.         if (PMA_MYSQL_INT_VERSION >= 40100) {
  615.             echo '        <td width="25"> </td>' . "\n"
  616.                . '        <td>' . "\n"
  617.                . '            <select name="tbl_charset">' . "\n";
  618.             for ($i = 0; isset($mysql_charsets[$i]); $i++) {
  619.                 echo '                <option value="' . $mysql_charsets[$i] . '"' . ($mysql_charsets[$i] == 'latin1' ? ' selected="selected"' : '') . '>' . $mysql_charsets[$i] . '</option>' . "\n";
  620.             }
  621.             unset($i);
  622.             echo '            </select>' . "\n"
  623.                . '        </td>' . "\n";
  624.         }
  625.     }
  626.     echo "\n";
  627.     ?>
  628.         </tr>
  629.     </table>
  630.     <br />
  631.     <?php
  632. }
  633. echo "\n";
  634. // END - Table Type - 2 May 2001 - Robbat2
  635. ?>
  636.  
  637. <input type="submit" name="submit" value="<?php echo $strSave; ?>" />
  638. </form>
  639.  
  640. <table>
  641. <tr>
  642.     <td valign="top">* </td>
  643.     <td>
  644.         <?php echo $strSetEnumVal . "\n"; ?>
  645.     </td>
  646. </tr>
  647. <tr>
  648.     <td valign="top">** </td>
  649.     <td>
  650.         <?php echo $strDefaultValueHelp . "\n"; ?>
  651.     </td>
  652. </tr>
  653.  
  654. <?php
  655. if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
  656. ?>
  657. <tr>
  658.     <td valign="top" rowspan="2">*** </td>
  659.     <td>
  660.         <?php echo $strMIME_transformation_options_note  . "\n"; ?>
  661.     </td>
  662. </tr>
  663.  
  664. <tr>
  665.     <td>
  666.         <?php echo sprintf($strMIME_transformation_note, '<a href="libraries/transformations/overview.php?' . PMA_generate_common_url($db, $table) . '" target="_blank">', '</a>') . "\n"; ?>
  667.     </td>
  668. </tr>
  669. <?php
  670. }
  671. ?>
  672.  
  673. </table>
  674. <br />
  675.  
  676. <center><?php echo PMA_showMySQLDocu('Reference', 'CREATE_TABLE'); ?></center>
  677.